package com.hujesse.controller;
import com.google.gson.Gson;
import com.hujesse.service.menu.MenuServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

@RestController
@CrossOrigin
public class MenuController {
    @Autowired
    private MenuServiceImpl menuService;
    @RequestMapping("/menus")
    public String getAllMenus(){
        System.out.println("访问成功");
        Map<String, Object> menus = menuService.getMenus();
        Gson gson = new Gson();
        String s = gson.toJson(menus);
        return s;
    }
}
